/*
 * @Author: fisher luthor-li@qq.com
 * @Date: 2024-03-05 17:00:24
 * @LastEditors: fisher luthor-li@qq.com
 * @LastEditTime: 2024-09-11 11:31:43
 * @FilePath: \fpstream\rollup.config.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import babel from "@rollup/plugin-babel";
import resolve from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import { terser } from "rollup-plugin-terser";
const babelOptions = {
  babelHelpers: "bundled",
  presets: [["@babel/preset-env", { modules: false }]],
  plugins: [
    "@babel/plugin-proposal-class-properties",
    "@babel/plugin-proposal-private-methods",
  ],
};

// const external = [
//   "@epicgames-ps/lib-pixelstreamingfrontend-ue5.3",
//   "pako",
//   "str2gbk",
// ];

export default {
  input: "./index.js", // 您项目的入口文件
  output: {
    file: "dist/bundle.js", // 输出的文件路径
    format: "umd", // 输出的格式
    name: "Fpstream", // 全局变量名
    // globals: {
    //   "@epicgames-ps/lib-pixelstreamingfrontend-ue5.3":
    //     "LibPixelStreamingFrontend",
    //   pako: "pako",
    //   str2gbk: "str2gbk",
    // },
  },
  // external: external,
  plugins: [
    resolve({
      // browser: true, // 如果您的依赖包需要在浏览器环境下使用
      // 将.js外的文件视为外部依赖
      extensions: [".mjs", ".js", ".jsx", ".json", ".node"],
    }),
    commonjs(),
    babel(babelOptions),
    terser(), // 如果您需要压缩输出
  ],
  // 其他适应您项目的配置选项......
};
